Skip to content

fix(accounts): return to Accounts screen from flows started outside it - #641

Merged
n13 merged 2 commits into
mainfrom
n13/return-to-accounts-nav-fix
Sep 8, 2026
Merged

fix(accounts): return to Accounts screen from flows started outside it#641
n13 merged 2 commits into
mainfrom
n13/return-to-accounts-nav-fix

Conversation

@n13

@n13 n13 commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Problem

After creating a multisig from Settings → Add account → Create multisig, the app went black. The same happens for Create account and Import wallet started from Settings.

returnToAccountsScreen pops until it finds the Accounts route. From the Accounts screen that route is in the stack and it works. From Settings there is no Accounts route, so popUntil pops every screen and leaves the Navigator empty ('_history.isNotEmpty': is not true on hot reload).

Fix

  • returnToAccountsScreen pops to the Accounts route when present, otherwise to the root, and then pushes a fresh Accounts screen.
  • The new-account highlight is passed to that fresh screen via a constructor parameter. The openAccountsIntentProvider listener only fires on an already mounted screen, so it stays the mechanism for the pop-back case.
  • openAccountsScreen moved into accounts_navigation.dart so the navigation helpers live together without a circular import.

Also bumps the AGENTS.md analyzer rule to 10 seconds: the analysis server hangs on this machine, tests are the compile check.

Test

  • Settings → Add account → Create multisig → after submission you land on Home → Accounts with the new multisig highlighted.
  • Accounts → Add account → Create multisig still pops back to the existing Accounts screen.
  • flutter test test/screens/home_intent_gating_test.dart compiles the home + accounts chain and passes.

returnToAccountsScreen popped until it found the Accounts route. Flows
started from Settings > Add account (create multisig, create account,
import wallet) have no Accounts route in the stack, so popUntil emptied
the Navigator and left a black screen.

Pop to the Accounts route when it is in the stack, otherwise pop to the
root and push a fresh Accounts screen. The highlight for the new account
is passed to that fresh screen directly, since the open-accounts intent
listener only fires on an already-mounted screen.
@n13 n13 added the bot-review Request automated review from review-bot label Sep 8, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer model: GPT-6 Astra

Verdict (advisory): Approve

Reviewed 1a16a50c112291c4096f42cd02465341cb84e968 against base 0b7d2033e515e9f2ec1c52152052ea000ef6b78c in a detached worktree. No blocking findings.

The root-route guard prevents Settings-originated add/import flows from emptying the Navigator. Returning to an existing Accounts route retains its state and sends the highlight intent; opening a fresh route passes the highlight through the constructor before its first build. All callers of the relocated helper resolve correctly. I also traced account creation, wallet import/naming, multisig creation, hardware-account completion, and disconnect callers.

Validation:

  • flutter test --no-pub --reporter expanded test/screens/home_intent_gating_test.dart test/unit/accounts_grouping_test.dart: all 15 tests passed.
  • dart run melos exec -- dart format lib test --line-length=120 --output=none --set-exit-if-changed: passed across all four packages, with no changes.
  • git diff --check: passed for the complete PR diff.
  • GitHub Analyze CI succeeded on the reviewed head.
  • Local dart run melos run analyze was stopped at the required 10-second limit; it did not complete workspace analysis.

Non-blocking coverage improvement: add a widget regression for both Settings-originated and Accounts-originated completion, checking the resulting route stack, new-account highlight, and Back navigation. The existing focused tests compile the affected navigation chain but do not directly exercise this return helper; I did not perform an interactive device test.

@n13 n13 removed the bot-review Request automated review from review-bot label Sep 8, 2026
@n13
n13 force-pushed the n13/return-to-accounts-nav-fix branch from 1a16a50 to 105a56f Compare September 8, 2026 03:18
@n13
n13 force-pushed the n13/return-to-accounts-nav-fix branch from 105a56f to 1617545 Compare September 8, 2026 03:18
@n13
n13 merged commit b98c134 into main Sep 8, 2026
2 checks passed
@n13
n13 deleted the n13/return-to-accounts-nav-fix branch September 8, 2026 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant